const mongoose = require('./db');
const { getId } = require ( '../utils/getMethods' )

const regionListSchema = new mongoose.Schema({
	regionId: {type: Number,default: () => getId},
	regionName: {type: String,required: true}
})

const leaderAddressContentSchema = new mongoose.Schema({
	id: {type: Number,default: () => getId},
	takeName: {type: String,required: true},
	location: {type: Object},
	storePath: {type: String,required: true},
	detailAddress: {type: String,required: true},
	distance: {type: Number,required: true}
})

const leaderAddressSchema = new mongoose.Schema({
	userId: {type: Number,default: () => getId},
	leaderId: {type: Number,default: () => getId},
	leaderName: String,
	leaderPhone: String,
	takeName: {type: String,required: true},
	detailAddress: {type: String,required: true},
	longitude: {type: Number},
	latitude: {type: Number},
	storePath: {type: String,required: true}
})

const regionListModel = mongoose.model('regionList', regionListSchema, 'regionList')
// const leaderAddressContentModel = mongoose.model('leaderAddress', leaderAddressContentSchema, 'leaderAddress')
const leaderAddressModel = mongoose.model('leaderAddress', leaderAddressSchema, 'leaderAddress')

module.exports = {
	leaderAddressModel,
	// leaderAddressContentModel,
	regionListModel
}